package com.bosssoft.springboot.demo3;


import com.bosssoft.springboot.consumingwebservice.wsdl.GetMobileCodeInfoResponse;
import com.bosssoft.springboot.demo3.client.GetMobileInfoClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

@Slf4j
@SpringBootApplication
public class ConsumingWebServiceApplication {
    public static void main(String[] args) {
        SpringApplication.run(ConsumingWebServiceApplication.class,args);
    }

    @Bean
    CommandLineRunner lookup(GetMobileInfoClient client){
        return args -> {
            String phoneNum = "18878103132";
            if (args.length>0){
                phoneNum = args[0];
            }

            GetMobileCodeInfoResponse response = client.getMobileInfo(phoneNum);
            log.info("成功调用取得信息：{}",response.getGetMobileCodeInfoResult());
        };
    }

}
